
package com.seekting.study;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class IteratorTest {

    public static void main(String[] args) {
        List<String> s = new ArrayList<String>();
        s.add("1");
        s.add("2");
        Iterator<String> i = s.iterator();
        while (i.hasNext()) {
            System.out.println(i.next());
            i.remove();
        }
        System.out.println(s.size());
    }
}
